package com.cy.pj.sys.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.cy.pj.common.util.ShiroUtils;
import com.cy.pj.sys.entity.SysMember;

@Controller
public class PageController {
	
	@RequestMapping("/{page}")
	public String doPageUI(@PathVariable String page) {
		return page;
	}
	
	@RequestMapping("doLoginUI")
	public String doLoginUI(){
			return "login";
	}
	
	
	/**返回项目的主页面*/
	@RequestMapping("/doIndexUI")
	public String doIndexUI(Model model) {
		// 将用户对象绑定到model域中 
		model.addAttribute("user",ShiroUtils.getMember());
		// 基于shiro的工具类获取用户对象
		SysMember member=ShiroUtils.getMember();
		// 绑定用户名到域中
		model.addAttribute("memberName", member.getMemberName());
		// 基于用户id查询菜单
		
		return "index";
	}
	
	
}
